public class Test {
    public static void draw(Shape shape)
    {
        shape.draw1();
    }
    public static void main(String[] args) {
        Rect rect = new Rect();
        draw(rect);
        Flower flower = new Flower();
        draw(flower);
        //new Rect() --> 匿名对象 缺点：每次使用都得重新实例化
        draw(new Rect());
        draw(new Flower());
    }
}
abstract class Shape{
    public int a = 10;
    public abstract void draw1();//抽象方法
    public Shape(){
        //用来让子类调用，帮助这个抽象类初始化自己的成员
    }
//    public void draw(){
//        //System.out.println("画图形");
//    }
}
class Rect extends Shape{
    @Override
    public void draw1() {
        System.out.println("矩形");
    }
}
class Flower extends Shape{
    @Override
    public void draw1() {
        System.out.println("❀");
    }
}
abstract class A extends Shape{
    public abstract void draw2();
}
//出来混迟早要还
class B extends A{
    @Override
    public void draw2() {

    }

    @Override
    public void draw1() {

    }
}